<!DOCTYPE HTML>
<html lang="en">
<head>
<title>#NoTrayIcon - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The #NoTrayIcon directive disables the showing of a tray icon." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>#NoTrayIcon</h1>

<p>Disables the showing of a <a href="../Program.htm#tray-icon">tray icon</a>.</p>

<pre class="Syntax"><span class="func">#NoTrayIcon</span></pre>
<p>Specifying this anywhere in a script will prevent the showing of a tray icon for that script when it is launched (even if the script is compiled into an EXE).</p>
<p>If you use this for a script that has hotkeys, you might want to bind a hotkey to the <a href="ExitApp.htm">ExitApp</a> command. Otherwise, there will be no easy way to exit the program (without restarting the computer or killing the process). For example: <code>#x::ExitApp</code>.</p>
<p>The tray icon can be made to disappear or reappear at any time during the execution of the script by using the command <code><a href="Menu.htm">Menu</a>, Tray, Icon</code> or <code><a href="Menu.htm">Menu</a>, Tray, NoIcon</code>. The only drawback of using <code><a href="Menu.htm">Menu</a>, Tray, NoIcon</code> at the very top of the script is that the tray icon might be briefly visible when the script is first launched. To avoid that, use #NoTrayIcon instead.</p>
<p>The built-in variable <strong>A_IconHidden</strong> contains 1 if the tray icon is currently hidden or 0 otherwise.</p>
<h2>Related</h2>
<p><a href="../Program.htm#tray-icon">Tray Icon</a>, <a href="Menu.htm">Menu</a>, <a href="ExitApp.htm">ExitApp</a></p>
<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>#NoTrayIcon</pre>
</div>

</body>
</html>
